import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

const home = r => require.ensure([], () => r(require('@/page/home')), 'home');
const historyHomeChartDataList = r => require.ensure([], () => r(require('@/page/historyHomeChartDataList')), 'historyHomeChartDataList');
const login = r => require.ensure([], () => r(require('@/page/login')), 'login');
const manage = r => require.ensure([], () => r(require('@/page/manage')), 'manage');
const userList = r => require.ensure([], () => r(require('@/page/userList')), 'userList');
const serviceList = r => require.ensure([], () => r(require('@/page/serviceList')), 'serviceList');
const pregnancyEcharts = r => require.ensure([], () => r(require('@/page/pregnancyEcharts')), 'pregnancyEcharts');
const changePassword = r => require.ensure([], () => r(require('@/page/changePassword')), 'changePassword');
const feedback = r => require.ensure([], () => r(require('@/page/feedback')), 'feedback');
const feedbackHistory = r => require.ensure([], () => r(require('@/page/feedbackHistory')), 'feedbackHistory');
const serviceMessageTemplate = r => require.ensure([], () => r(require('@/page/serviceMessageTemplate')), 'serviceMessageTemplate');
const sendMessage = r => require.ensure([], () => r(require('@/page/sendMessage')), 'sendMessage');
const messageView = r => require.ensure([], () => r(require('@/page/messageView')), 'messageView');
const onSitePush = r => require.ensure([], () => r(require('@/page/onSitePush')), 'onSitePush');
const outSitePush = r => require.ensure([], () => r(require('@/page/outSitePush')), 'outSitePush');
const sendNewMessage = r => require.ensure([], () => r(require('@/page/sendNewMessage')), 'sendNewMessage');
const messageTemplate = r => require.ensure([], () => r(require('@/page/messageTemplate')), 'messageTemplate');
const youMengPushTemplate = r => require.ensure([], () => r(require('@/page/youMengPushTemplate')), 'youMengPushTemplate');
const equipmentManage = r => require.ensure([], () => r(require('@/page/equipmentManage')), 'equipmentManage');
const equipmentHistorybind = r => require.ensure([], () => r(require('@/page/equipmentHistorybind')), 'equipmentHistorybind');
const uploadImg = r => require.ensure([], () => r(require('@/page/uploadImg')), 'uploadImg');

export default new Router({
  routes: [{
    path: '/',
    component: login
  }, {
    path: '/manage',
    component: manage,
    name: '',
    children: [{
        path: '',
        component: home,
        meta: ['首页']
      }, {
        path: '/historyHomeChartDataList',
        component: historyHomeChartDataList,
        meta: ['首页', '历史数据']
      }, {
        path: '/userList',
        component: userList,
        meta: ['数据管理', '用户列表']
      },
      {
        path: '/serviceList',
        component: serviceList,
        meta: ['数据管理', '异常数据']
      },
      {
        path: '/pregnancyEcharts',
        component: pregnancyEcharts,
        meta: ['数据管理', '折线图']
      },
      {
        path: '/changePassword',
        component: changePassword,
        meta: ['修改密码']
      },
      {
        path: '/feedback',
        component: feedback,
        meta: ['客服管理', '问题反馈']
      },
      {
        path: '/feedbackHistory',
        component: feedbackHistory,
        meta: ['问题反馈', '问题反馈历史']
      },
      {
        path: '/serviceMessageTemplate',
        component: serviceMessageTemplate,
        meta: ['客服管理', '模板设置']
      },
      {
        path: '/sendMessage',
        component: sendMessage,
        meta: ['消息管理', '消息推送']
      },
      {
        path: '/messageView',
        component: messageView,
        meta: ['消息管理', '推送详情']
      },
      {
        path: '/onSitePush',
        component: onSitePush,
        meta: ['消息管理', '站内APP推送']
      },
      {
        path: '/outSitePush',
        component: outSitePush,
        meta: ['消息管理', '站外APP推送']
      },
      {
        path: '/sendNewMessage',
        component: sendNewMessage,
        meta: ['消息管理', '新建短信推送']
      },
      {
        path: '/messageTemplate',
        component: messageTemplate,
        meta: ['模板管理', '短信模板']
      },
      {
        path: '/youMengPushTemplate',
        component: youMengPushTemplate,
        meta: ['模板管理', '站外模板']
      },
      {
        path: '/equipmentManage',
        component: equipmentManage,
        meta: ['设备管理', '设备列表']
      },
      {
        path: '/equipmentHistorybind',
        component: equipmentHistorybind,
        meta: ['设备管理', '绑定历史']
      },
      {
        path: '/uploadImg',
        component: uploadImg,
        meta: ['上传图片']
      }
    ]
  }]
})
